﻿using System.Threading.Tasks;

namespace TK.Mqtt.Client
{
    /// <summary>
    /// 接收数据处理
    /// </summary>
    public interface IDataHandler
    {
        /// <summary>
        /// 输出数据
        /// </summary>
        Task ReceiveDataAync(CallbackData data);
    }

    /// <summary>
    /// 事件数据
    /// </summary>
    public class CallbackData
    {
        /// <summary>
        /// 类型
        /// </summary>
        public DataType Type { get; set; }

        /// <summary>
        /// 客户端配置
        /// </summary>
        public ClientConfig ClientConfig { get; set; }

        /// <summary>
        /// 当前订阅主题
        /// </summary>
        public string Topic { get; set; }

        /// <summary>
        /// 订阅数据
        /// </summary>
        public byte[] Data { get; set; }

        /// <summary>
        /// 信息
        /// </summary>
        public string Message { get; set; }
    }
}
